package com.net.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.net.dao.RoleDao;
import com.net.model.Role;
import com.net.service.RoleService;
@Component("roleService")
public class RoleServiceImpl implements RoleService {
	private RoleDao roleDao ;

	public RoleDao getRoleDao() {
		return roleDao;
	}
	@Resource(name="roleDao")
	public void setRoleDao(RoleDao roleDao) {
		this.roleDao = roleDao;
	}
	public boolean delete(Role u) {
		return roleDao.delete(u);
	}
	public List<Role> getRoles(int currentPage, int perPage, String orderType,
			String orderName) {
		return roleDao.getRoles(currentPage, perPage, orderType, orderName);
	}
	public List<Role> getRolesByCondition(int currentPage, int perPage,
			String condition) {
		return roleDao.getRolesByCondition(currentPage, perPage, condition);
	}
	public Role loadRoleById(int id) {
		return roleDao.loadRoleById(id);
	}
	public Role loadRoleByName(String name) {
		return roleDao.loadRoleByName(name);
	}
	public void add(Role u) {
		roleDao.save(u);
	}
	public void update(Role role) {
		roleDao.update(role);
	}
	public int getCount(){
		return roleDao.getCount();
	}
}
